package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `json:"username"`
	Password string `json:"password"`
}
type News struct {
	gorm.Model
	Title        string `json:"title"`
	Content      string `json:"content"`
	Img          string `json:"img"`
	UserId       int    `json:"user_id"`
	User         User   `gorm:"foreignKey:UserId"`
	CommentCount int    `json:"comment_count"`
}
type Comment struct {
	gorm.Model
	Content string `json:"content"`
	UserId  int    `json:"user_id"`
	NewsId  int    `json:"news_id"`
	User    User   `gorm:"foreignKey:UserId"`
	News    News   `gorm:"foreignKey:NewsId"`
}
